﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MvcApplication6.DAL;
using MvcApplication6.Models;

namespace MvcApplication6.BIZ
{
    public class SalePersonBIZ
    {
        SalePersonDAL DAL = new SalePersonDAL();

        //---------------------SalePersonSearch-----------------------------
        public List<SalePersonModel> SalePersonSearch()
        {
            try
            {
                List<SalePersonModel> lst = DAL.SalePersonSearch();
                return lst;
            }
            catch (Exception)
            {
                throw;
            }

        }

        //-------------------SalePersonById-------------------
        public SalePersonModel SalePersonSearchById(int id)
        {
            try
            {
                SalePersonModel lst = new SalePersonModel();
                lst = DAL.SalePersonSearchById(id);

                return lst;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //---------------------SalePersonInsert-----------------------------
        public int SalePersonInsert(string phone, string skype, string yahoo)
        {
            try
            {
                int i = DAL.SalePersonInsert(phone, skype, yahoo);

                return i;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //---------------------SalePersonUpdate-----------------------------
        public int SalePersonUpdate(int id, string phone, string skype, string yahoo)
        {
            try
            {
                int i = DAL.SalePersonUpdate(id, phone, skype, yahoo);

                return i;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //---------------------SalePersonDelete-----------------------------
        public int SalePersonDelete(int id)
        {
            try
            {
                int i = DAL.SalePersonDelete(id);

                return i;
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}